package com.task.server.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.task.mapper.GroupUserMapper;
import com.task.pojo.GroupUser;
import com.task.server.GroupUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author JiaFuJun
 * @version v1.0
 * @date 2020-03-25
 */
@Service("GroupUserService")
public class GroupUserServiceImpl implements GroupUserService {
    @Autowired
    private GroupUserMapper groupUserMapper;

    @Override
    public void insert(GroupUser record) {
        groupUserMapper.insert(record);
    }

    @Override
    public void update(GroupUser record){
        groupUserMapper.update(record);
    }

    @Override
    public void del(Object id){
        groupUserMapper.del(id);
    }

    @Override
    public GroupUser selectByPrimaryKey(Object id){
        return groupUserMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<GroupUser> getList(GroupUser record){
        return groupUserMapper.selectByRecord(record);
    }

    @Override
    public PageInfo<GroupUser> pageList(GroupUser record, Integer pageNo, Integer pageSize){
        PageHelper.startPage(pageNo, pageSize);
        List<GroupUser> list = groupUserMapper.selectByRecord(record);
        return new PageInfo<>(list);
    }

    @Override
    public List<String> getUsers(String groupId) {
        return groupUserMapper.getUsers(groupId);
    }

}